<?php
/*
专业管理模块
*/
include_once('include/top.php');

$action=fs_get_value("do");
switch($action)
{
	case	"addmember"	     : addmember()	         ; break;
        case	"addmajor"	     : addmajor()	         ; break;
	case	"do_addmajor"	         : do_addmajor()	     ; break;
	case	"deletemajor"	     : delete_major()	     ; break;
	case    "searchmember"   : searchmember()        ; break;
    
    case	"department"	     : department()	     ; break;
    case	"editdepartment"	     : editdepartment()	         ; break;
        case	"adddepartment"	     : adddepartment()	         ; break;
	case	"do_adddepartment"	         : do_adddepartment()	     ; break;
	case	"deletedepartment"	     : delete_department()	     ; break;
    case	"searchdepartment"	     : searchdepartment()	     ; break;
    case	"searchmajor"	     : searchmajor()	     ; break;
	default				     : main()		         ; break;
}
?>
<?php
function main()
{
    global $db;
    $departid = fs_get_value("departid");
    $majorname = fs_get_value("majorname");
	$conditionarray = array($departid,$majorname);
	$valuearray = array(" and departmentid = '".$departid."'"," and name like '%".$majorname."%'");
	$sql = "select * from nettteach_major where 1=1";
	for($i=0;$i<count($conditionarray);$i++ ){
		if($conditionarray[$i] == ''){
			$valuearray[$i] = '';
		}
		$sql.=$valuearray[$i];
	}
    $sql.=" order by departmentid";
	$major_result = $db -> query($sql);
	$recordcount = $db -> num_rows($major_result);
	@$page=$_GET['p'];
	if ($page==null){$page=1;}
	$pagesize=15;								//每页显示数
	$pagecount=ceil($recordcount/$pagesize);	//计算总页
	if ($page>$pagecount){$page=$pagecount;}
	if ($page<1){$page=1;}
?>
<script src="./js/Main.js"></script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr>
    <th class="CTitle">专业管理</th>
  </tr>
  <tr>
    <td class="CPanel">
    <div class="SubMenu">
           <a href="admin_department_major.php?do=department">系管理</a> | 
           <a href="admin_department_major.php?do=adddepartment">添加系</a> |
           <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
           <a href="admin_department_major.php?">专业管理</a> | 
           <a href="admin_department_major.php?do=addmajor">添加专业</a> | 
           <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
	</div>
	
	<form action="?do=deletemajor" method="post" name="fooeeform" style="margin:0px">
		<table border="0" cellpadding="0" cellspacing="0"  class="TablePanel" width="100%">
			<tr align="center" class="TDHead">
				<td nowrap><input type=button style="font-size:9pt;width:50px;" value="全选" onclick="click_allid(fooeeform,1)"/></td>
				<td nowrap><input type=button style="font-size:9pt;width:60px;" value="全取消" onclick="click_allid(fooeeform,0)"/></td>
				<td nowrap><input type="submit" style="font-size:9pt;width:50px;" value="删除" onclick="return delid()"/></td>

				<td nowrap width="500"><input type=button style="font-size:9pt;width:80px;" onclick="window.location.href('admin_department_major.php?do=searchmajor')" value="搜索专业" />
				</td>
				<td nowrap>.</td>
				<td nowrap>.</td>
				<td width="30%" nowrap></td>
				<td nowrap></td>
			</tr>
		</table>
<div id="click_idall">
    <div align="left" style="padding:5px;">
      <table border="0" cellpadding="0" cellspacing="0" class="TablePanel" align="center" width="100%">
        <tr align="center">
		  <td class="TDHead">√</td>
          <td class="TDHead" nowrap>专业名称</td>
          <td class="TDHead" nowrap>所属系</td>
          <td class="TDHead" nowrap>操 作</td>
        <!--  <td class="TDHead" nowrap>登陆记录</td>-->
        </tr>
<?php
	$major_result=$db->query($sql." limit ".($page-1)*($pagesize).",$pagesize");
	while($major_row = $db->fetch_array($major_result))
	{
?>
		<tr id="t<?php echo($major_row["id"]);?>" onclick="click_tr('<?php echo ($major_row["id"]);?>')" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'" title=单击选中 align="center">
			<td height="27"><input name='id[]' type='checkbox' id="c<?php echo($major_row["id"]);?>" value='<?php echo ($major_row["id"]);?>' onclick="click_tr('<?php echo ($major_row["id"]);?>')"></td>
			<td><a href="?do=addmember&major_id=<?php echo ($major_row["id"]);?>"><?php echo($major_row["name"]);?></a></td>
                        <td><?php echo fs_get_departname($major_row['departmentid']);?></td>
			<td><a href="?do=addmember&major_id=<?php echo ($major_row["id"]);?>">编缉</a></td>
		</tr>
		<tr>
			<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
		</tr>
<?php
	}
?>
	</table></div>
	</div>
	</form>
	<center>
<?php
/*分页示例:

pager(传入URL , 数据总数 , 开始条数 , 每页数目)
*/
echo(pager('?p={page}',$recordcount,($page-1)*($pagesize),$pagesize));		
?>
                
</center>
	</td>
	</tr>
	</table>

<?php
}
function fs_get_departname($i)
{
	if ( $i=='' || is_null($i) || !is_numeric($i))	{return '无';break;}
	global $db;
	$sql	=	"select name from ".TABLE_DEPARTMENT." where id=$i ";
	$result =	$db -> query($sql);
	$row	=	$db -> fetch_array($result);
	return	$row['name'];
}
?>
<!--
编缉专业开始
-->
<?php
function addmember()
{
    global $db;
	$major_id = fs_get_value("major_id");
	if($major_id != ''){
		$sql = "select * from nettteach_major where id = ".$major_id;
		$major_result = $db -> query($sql);
		$major_row = $db -> fetch_array($major_result);
	}
?>
<script>
function   CheckMajor(){
     if(document.addform.departid.value ==  ""){
        alert("请选择系!");
        document.addform.departid.focus();
        return  false;
    }
    if(document.addform.majorname.value ==  ""){
        alert("请输入专业名");
        document.addform.majorname.focus();
        return  false;
    }
}  
</script>
<script src="./js/Main.js"></script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">专业管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
    <div class="SubMenu">
        <a href="admin_department_major.php?do=department">系管理</a> | 
        <a href="admin_department_major.php?do=adddepartment">添加系</a> |
           <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
		<a href="admin_department_major.php?">专业管理</a> | 
        <a href="admin_department_major.php?do=addmajor">添加专业</a> | 
           <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
	</div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="addform" method="post" action="?do=do_addmajor&major_id=<?php echo($major_id);?>&departmentid=<?php echo $major_row['departmentid'];?>">
			<fieldset>
				<legend>编辑专业</legend><br/><br/>
                    <label>系名称：</label>
                            <select name="departid" id="class1" style="width:300px;" >
                                    <option value="">请选择系</option>
                                    <?php
                                    $sql="select* from nettteach_department where 1=1";
                                    $result=mysql_query($sql);
                                    //循环列出选项
                                    while($rows=mysql_fetch_array($result))
                                    {?>
                                            <option  value="<?php echo $rows['id'];?>"<?php if($major_row['departmentid'] == $rows['id']) echo "selected"; ?> ><?php echo $rows['name'];?></option>
                                    <?php } ?>
                            </select> <br/><br/>
                    <label>专业名称：</label><input name="majorname" type="text"  class="text" value="<?php echo ($major_row['name'])?>" ><br/><br/>
					
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" onclick="return CheckMajor();"/>&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
function do_addmajor(){
        global $db;
        $majorname = trim(fs_get_value("majorname"));
        $departid = fs_get_value("departid");   //修改后的系
        $departmentid = fs_get_value("departmentid");  //修改前的系
                //添加专业
        if($majorname != '' || $departid != ''){
                if(fs_get_value("major_id") == ''){
                            $sql = "insert into nettteach_major (name,departmentid) value ('".$majorname."','".$departid."')";
                            $db->query($sql);
                }else{
                        //修改专业
                        $id = fs_get_value("major_id");
                        $sql_check = "select * from nettteach_class where majorid = ".$id;
                        $result= $db->query($sql_check);
                        $num = $db->num_rows($result);
                        if($num ==0){
                                $sql = "update nettteach_major  set name = '".$majorname."',departmentid = '".$departid."' where id = ".$id;
                                $db -> query($sql);
                        }else{                      
                            if($departmentid == $departid){
                                $sql = "update nettteach_major  set name = '".$majorname."' where id = ".$id;
                                $db -> query($sql);
                            }else{
                                fs_showmsg("专业下有班级，不能修改所属系");
                                exit();
                            }
                        }
                }
        }else{
                        fs_showmsg("系或专业不能为空！");
                        exit();
        }
        if(fs_get_value("major_id") == ''){
                fs_showmsg("添加成功！");
        }
        else{
                fs_showmsg("修改成功！");
        }
}
?>
<!--
编缉专业结束
-->
<!--
添加专业开始
-->
<?php
function addmajor()
{
    global $db;
?>
<script>
function   CheckMajor(){
     if(document.addform.departid.value ==  ""){
        alert("请选择系!");
        document.addform.departid.focus();
        return  false;
    }
    if(document.addform.majorname.value ==  ""){
        alert("请输入专业名");
        document.addform.majorname.focus();
        return  false;
    }
}  
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">专业管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
                <div class="SubMenu">
                   <a href="admin_department_major.php?do=department">系管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加系</a> |
                   <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
                   <a href="admin_department_major.php?">专业管理</a> | 
                   <a href="admin_department_major.php?do=addmajor">添加专业</a> | 
                   <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
                </div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="addform" method="post" action="?do=do_addmajor&major_id=<?php echo($major_id);?>">
			<fieldset>
				<legend>添加专业</legend><br/><br/>
                    <label>系名称：</label>
                            <select name="departid" id="class1" style="width:300px;" >
                                    <option value="">请选择系</option>
                                    <?php
                                    $sql="select* from nettteach_department where 1=1";
                                    $result=mysql_query($sql);
                                    //循环列出选项
                                    while($rows=mysql_fetch_array($result))
                                    {?>
                                            <option value=<?php echo $rows['id']; ?>><?php echo $rows['name'];?></option>
                                    <?php } ?>
                            </select> <br/><br/>
                    <label>专业名称：</label><input name="majorname" type="text"  class="text" value="" ><br/><br/>
					
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" onclick="return CheckMajor();"/>&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
?>
<!--
添加专业结束
-->

<?php
//删除专业
function delete_major()
{
    global $db;
	$i=0;
	$major_id = $_POST['id'];
        if($major_id != ''){
                while($major_id){
                    if($major_id[$i]==null) break;
                        $sql = "delete from nettteach_major where id = ".$major_id[$i]."";
                        
                        $sqlmajor = "select * from nettteach_member where majorid = ".$major_id[$i];
                        $result = $db -> query($sqlmajor);
                        $result_row = $db -> fetch_array($result);
                        $sqlclass = "select * from nettteach_class where majorid = ".$major_id[$i];
                        $result_class = $db -> query($sqlclass);
                        $result_row_class = $db -> fetch_array($result_class);
                        if($result_row['id'] == '' && $result_row_class['id'] ==''){
                                $db -> query($sql);
                        }else{
                                fs_showmsg("该专业下有教师或班级,不能删除");
                        }
                        $i++;
                }
                fs_showmsg('删除成功!');
        }else{
                fs_showmsg('请选择要删除的专业!');
        }
}
?>

<!--
以下是系的增删改
-->

<?php
function department()
{
    global $db;
    $departmentname = fs_get_value("departmentname");
	$conditionarray = array($departmentname);
	$valuearray = array(" and name like '%".$departmentname."%'");
	$sql = "select * from nettteach_department where 1=1 ";
	for($i=0;$i<count($conditionarray);$i++ ){
		if($conditionarray[$i] == ''){
			$valuearray[$i] = '';
		}
		$sql.=$valuearray[$i];
	}

	$department_result = $db -> query($sql);
	$recordcount = $db -> num_rows($department_result);
	@$page=$_GET['p'];
	if ($page==null){$page=1;}
	$pagesize=15;								//每页显示数
	$pagecount=ceil($recordcount/$pagesize);	//计算总页
	if ($page>$pagecount){$page=$pagecount;}
	if ($page<1){$page=1;}
?>
<script src="./js/Main.js"></script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr>
    <th class="CTitle">系管理</th>
  </tr>
  <tr>
    <td class="CPanel">
    <div class="SubMenu">
           <a href="admin_department_major.php?do=department">系管理</a> | 
           <a href="admin_department_major.php?do=adddepartment">添加系</a> |
           <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
           <a href="admin_department_major.php?">专业管理</a> | 
           <a href="admin_department_major.php?do=adddepartment">添加专业</a> | 
           <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
	</div>
	<form action="?do=deletedepartment" method="post" name="fooeeform" style="margin:0px">
		<table border="0" cellpadding="0" cellspacing="0"  class="TablePanel" width="100%">
			<tr align="center" class="TDHead">
				<td nowrap><input type=button style="font-size:9pt;width:50px;" value="全选" onclick="click_allid(fooeeform,1)"/></td>
				<td nowrap><input type=button style="font-size:9pt;width:60px;" value="全取消" onclick="click_allid(fooeeform,0)"/></td>
				<td nowrap><input type="submit" style="font-size:9pt;width:50px;" value="删除" onclick="return delid()"/></td>

				<td nowrap width="500"><input type=button style="font-size:9pt;width:80px;" onclick="window.location.href('admin_department_major.php?do=searchdepartment')" value="搜索系" />
				</td>
				<td nowrap>.</td>
				<td nowrap>.</td>
				<td width="30%" nowrap></td>
				<td nowrap></td>
			</tr>
		</table>
<div id="click_idall">
    <div align="left" style="padding:5px;">
      <table border="0" cellpadding="0" cellspacing="0" class="TablePanel" align="center" width="100%">
        <tr align="center">
		  <td class="TDHead">√</td>
          <td class="TDHead" nowrap>系名称</td>
          <td class="TDHead" nowrap>操 作</td>
        <!--  <td class="TDHead" nowrap>登陆记录</td>-->
        </tr>
<?php
	$department_result=$db->query($sql." limit ".($page-1)*($pagesize).",$pagesize");
	while($department_row = $db->fetch_array($department_result))
	{
?>
		<tr id="t<?php echo($department_row["id"]);?>" onclick="click_tr('<?php echo ($department_row["id"]);?>')" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='FFFFFF'" title=单击选中 align="center">
			<td height="27"><input name='id[]' type='checkbox' id="c<?php echo($department_row["id"]);?>" value='<?php echo ($department_row["id"]);?>' onclick="click_tr('<?php echo ($department_row["id"]);?>')"></td>
			<td><a href="?do=editdepartment&department_id=<?php echo ($department_row["id"]);?>"><?php echo($department_row["name"]);?></a></td>
			<td><a href="?do=editdepartment&department_id=<?php echo ($department_row["id"]);?>">编缉</a></td>
		</tr>
		<tr>
			<td height=1 colspan=10 bgcolor="#E8F1FF" onMouseOver="bgColor='#FF8899'" onMouseOut="bgColor='E7sxE7sxE7sx'"></td>
		</tr>
<?php
	}
?>
	</table></div>
	</div>
	</form>
	<center>
<?php
/*分页示例:

pager(传入URL , 数据总数 , 开始条数 , 每页数目)
*/
echo(pager('?do=department&p={page}',$recordcount,($page-1)*($pagesize),$pagesize));		
?>
                
</center>
	</td>
	</tr>
	</table>

<?php
}
?>
<!--
编缉系开始
-->
<?php
function editdepartment()
{
    global $db;
	$department_id = fs_get_value("department_id");
	if($department_id != ''){
		$sql = "select * from nettteach_department where id = ".$department_id;
		$department_result = $db -> query($sql);
		$department_row = $db -> fetch_array($department_result);
	}
?>
<script>
function   CheckDepartment(){
     if(document.addform.departmentname.value ==  ""){
        alert("系名不能为空!");
        document.addform.departmentname.focus();
        return  false;
    }
}  
</script>
<script src="./js/ajax.js"></script>
<script src="./js/Main.js"></script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">系管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
    <div class="SubMenu">
        <a href="admin_department_major.php?do=department">系管理</a> | 
        <a href="admin_department_major.php?do=adddepartment">添加系</a> |
        <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
		<a href="admin_department_major.php?">专业管理</a> | 
        <a href="admin_department_major.php?do=adddepartment">添加专业</a> | 
        <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
	</div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="addform" method="post" action="?do=do_adddepartment&department_id=<?php echo($department_id);?>">
			<fieldset>
				<legend>编辑系</legend><br/><br/>
                    <label>系名称：</label><input name="departmentname" type="text"  class="text" value="<?php echo ($department_row['name'])?>" ><br/><br/>
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" onclick="return CheckDepartment();"/>&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php?do=department">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
function do_adddepartment(){
        global $db;
        $departmentname = trim(fs_get_value("departmentname"));
        //添加系
        if($departmentname != '' ){
                if(fs_get_value("department_id") == ''){
                            $sql = "insert into nettteach_department (name) value ('".$departmentname."')";
                            $db->query($sql);
                }else{
                        //修改系
                        $id = fs_get_value("department_id");
                        $sql = "update nettteach_department  set name = '".$departmentname."' where id = ".$id;
                        $db -> query($sql);
                }
        }else{
                        fs_showmsg("系名称不能为空！");
                        exit();
        }
        if(fs_get_value("department_id") == ''){
                fs_showmsg("添加成功！");
        }
        else{
                fs_showmsg("修改成功！");
        }
}
?>
<!--
编缉系结束
-->
<!--
添加系开始
-->
<?php
function adddepartment()
{
    global $db;
?>
<script>
function   CheckDepartment(){
     if(document.addform.departmentname.value ==  ""){
        alert("系名不能为空!");
        document.addform.departmentname.focus();
        return  false;
    }
}  
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">系管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
                <div class="SubMenu">
                   <a href="admin_department_major.php?do=department">系管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加系</a> |
                   <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
                   <a href="admin_department_major.php?">专业管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加专业</a> | 
                   <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
                </div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="addform" method="post" action="?do=do_adddepartment&department_id=<?php echo($department_id);?>">
			<fieldset>
				<legend>添加系</legend><br/><br/>
                    <label>系名称：</label><input name="departmentname" type="text"  class="text" value="" ><br/><br/>
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" onclick="return CheckDepartment();"/>&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php?do=department">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
?>
<!--
添加系结束
-->

<?php
//删除系
function delete_department()
{
    global $db;
    $name='';
    $i=0;
	$department_id = $_POST['id'];
        if($department_id != ''){
                while($department_id){
                    if($department_id[$i]==null) break;
                        $sqlmajor = "select * from nettteach_major where departmentid = ".$department_id[$i];
                        $sql = "delete from nettteach_department where id = ".$department_id[$i]."";
                        $result = $db -> query($sqlmajor);
                        $result_row = $db -> fetch_array($result);
                        if($result_row['id'] != ''){
                                fs_showmsg("要删除的系下有专业,不能删除");
                        }else{
                                $db -> query($sql);
                        }
                        $i++;
                }
                fs_showmsg("删除成功");
        }else{
                fs_showmsg('请选择要删除的系!');
        }
}
?> 



<?php
function searchdepartment()
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">系管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
                <div class="SubMenu">
                   <a href="admin_department_major.php?do=department">系管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加系</a> |
                   <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
                   <a href="admin_department_major.php?">专业管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加专业</a> | 
                   <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
                </div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="searchform" method="post" action="?do=department" class="CContent">
			<fieldset>
				 <legend>搜索系</legend><label></label><br>
                    <label>系名称：</label><input name="departmentname" type="text"  class="text" value="" ><br/><br/>
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" />&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php?do=department">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
?>
<?php
function searchmajor()
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
		<tr>
		    <th class="CTitle">专业管理</th>
		</tr>	
		<tr>
			<td class="CPanel">
                <div class="SubMenu">
                   <a href="admin_department_major.php?do=department">系管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加系</a> |
                   <a href="admin_department_major.php?do=searchdepartment">搜索系</a> |
                   <a href="admin_department_major.php?">专业管理</a> | 
                   <a href="admin_department_major.php?do=adddepartment">添加专业</a> | 
                   <a href="admin_department_major.php?do=searchmajor">搜索专业</a> 
                </div>
			</td>
		</tr>	
		<tr>
			<td>
			<div class="middle_right_list" style="font-size:13px;">
			<form name="searchform" method="post" action="?do=main" class="CContent">
			<fieldset>
				 <legend>搜索专业</legend><label></label><br>
                    <label>所属系：</label>
                            <select name="departid" id="" style="width:300px;" >
                                    <option value="">请选择系</option>
                                    <?php
                                    $sql="select* from nettteach_department where 1=1";
                                    $result=mysql_query($sql);
                                    //循环列出选项
                                    while($rows=mysql_fetch_array($result))
                                    {?>
                                            <option value=<?php echo $rows['id']; ?>><?php echo $rows['name'];?></option>
                                    <?php } ?>
                            </select> <br/><br/>
                    <label>专业名称：</label><input name="majorname" type="text"  class="text" value="" ><br/><br/>
					<div class="submit">
					<label></label><input type="submit" class="sub" value="确认提交" />&nbsp;&nbsp;&nbsp;&nbsp;<a class="lj" href="admin_department_major.php?do=main">返回列表</a>
                    </div>
            </fieldset>
			</form>
			</div>
			</td>
		</tr>
	</table>
<?php
}
?>